/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 *//*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 *//*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 *//*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 *//*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 *//*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 *//*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 *//*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package poker_sim;

/**
 *
 * @author Rob
 */
public class InterfaceClass {
    public Table table;
    public UI Interface;
    
    public void UpdateHandCards(int nr)
    {
        //Interface.vHandCard.LoadCard(table.thePlayers[0].GetHand()[nr].IMG);
    }
    
    public InterfaceClass(Table _table, UI _Interface)
    {
        table = _table;
        Interface = _Interface;
    }
    public void UpdateTypeRecord()
    {
        
    }
    public void ResetHandCards()
    {
        Interface.vHandCard.Reset();
    }
    public void UpdateTypeTable(int player, int stage) {
        //Update logic
        switch (stage) {
            case 1:
                if(table != null)
                {
//                    Interface.TypeCount.setValueAt(table.thePlayers[player].Getname(), player, 0);
//                    Interface.TypeCount.setValueAt(table.pokerLogic.CardType[player][0], player, 1);
//                    Interface.TypeCount.setValueAt(table.pokerLogic.CardType[player][1], player, 2);
//                    Interface.TypeCount.setValueAt(table.pokerLogic.CardType[player][2], player, 3);
//                    Interface.TypeCount.setValueAt(table.pokerLogic.CardType[player][3], player, 4);
//                    Interface.TypeCount.setValueAt(table.thePlayers[player].GetHand()[0].Getfullname(), player, 5);
//                    Interface.TypeCount.setValueAt(table.thePlayers[player].GetHand()[1].Getfullname(), player, 6);
                }
                else 
                    throw new NullPointerException("Table is not initialized");
                break;
            case 2:
                break;
            case 3:
                break;
            default:
               // throw new AssertionError();
        }

    }
    public void UpdateTableCards(Card _TableCard, int position)
    {
        Interface.Tablecards.setValueAt(_TableCard.Getfullname(), 0, position);
    }
    
    public void UpdateStatistics(Player[] Players)
    {
        for (int i = 0; i < 9; i++) {
            Interface.Jtable.setValueAt(Players[i].Getname(), i, 0);
            Interface.Jtable.setValueAt(Players[i].Getscore(), i, 1);
        }
        Interface.Jtable.setValueAt(Players[0].Getname(), 0, 0);

        Card[] temphand = Players[0].GetHand();

        Interface.T_CARD1.setText(temphand[0].Getfullname());
        Interface.T_CARD2.setText(temphand[1].Getfullname());

        for (int i = 0; i < 5; i++) {
            Interface.Tablecards.setValueAt("", 0, i);
        }
    }
    
    public void UpdateHandRank(String HandRankName)
    {
        Interface.HandRankingState.setText(HandRankName);
    }
    
    public void UpdateBlinds(int blind, int _player)
    {
        Interface.Jtable.setValueAt(blind, _player, 4);
    }
}
